]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
environment: Generalize easeActorProperty to animatable case
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Thu, 4 Dec 2025 04:14:23 +0000 (05:14 +0100)
committerMarge Bot <marge-bot@gnome.org>
Fri, 5 Dec 2025 21:58:48 +0000 (21:58 +0000)
We're not handling actors only with it but also St.Adjustment that is a
Clutter.Animatable, so let's name it for what it is, and adjust the
parameter so that its type is not given for granted

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3991>

js/ui/environment.js

index 58114b0a778afb5a2000a23bd10d285f641dc280..369f9de49c8b271c6b6628345774f19c6d6080ae 100644 (file)
@@ -163,7 +163,7 @@ function _easeActor(actor, params) {
         callback(true);
 }
 
-function _easeActorProperty(actor, propName, target, params) {
+function _easeAnimatableProperty(animatable, propName, target, params) {
     params = {
         repeatCount: 0,
         autoReverse: false,
@@ -199,7 +199,7 @@ function _easeActorProperty(actor, propName, target, params) {
 
     // Copy Clutter's behavior for implicit animations, see
     // should_skip_implicit_transition()
-    if (actor instanceof Clutter.Actor && !actor.mapped)
+    if (animatable instanceof Clutter.Actor && !animatable.mapped)
         duration = 0;
 
     const prepare = () => {
@@ -213,10 +213,10 @@ function _easeActorProperty(actor, propName, target, params) {
     const callback = _makeEaseCallback(params, cleanup);
 
     // cancel overwritten transition
-    actor.remove_transition(propName);
+    animatable.remove_transition(propName);
 
     if (duration === 0) {
-        const [obj, prop] = _getPropertyTarget(actor, propName);
+        const [obj, prop] = _getPropertyTarget(animatable, propName);
 
         if (!isReversed)
             obj[prop] = target;
@@ -227,7 +227,7 @@ function _easeActorProperty(actor, propName, target, params) {
         return;
     }
 
-    const pspec = actor.find_property(propName);
+    const pspec = animatable.find_property(propName);
     const transition = new Clutter.PropertyTransition({
         property_name: propName,
         interval: new Clutter.Interval({value_type: pspec.value_type}),
@@ -236,7 +236,7 @@ function _easeActorProperty(actor, propName, target, params) {
         auto_reverse: autoReverse,
         ...params,
     });
-    actor.add_transition(propName, transition);
+    animatable.add_transition(propName, transition);
 
     transition.set_to(target);
 
@@ -303,12 +303,12 @@ Clutter.Actor.prototype.ease = function (props) {
     _easeActor(this, props);
 };
 Clutter.Actor.prototype.ease_property = function (propName, target, params) {
-    _easeActorProperty(this, propName, target, params);
+    _easeAnimatableProperty(this, propName, target, params);
 };
 St.Adjustment.prototype.ease = function (target, params) {
     // we're not an actor of course, but we implement the same
     // transition API as Clutter.Actor, so this works anyway
-    _easeActorProperty(this, 'value', target, params);
+    _easeAnimatableProperty(this, 'value', target, params);
 };
 
 Clutter.Actor.prototype[Symbol.iterator] = function* () {